package com.itheima.demo;

public class BubbleSortDemo {


    public static void main(String[] args) {
        int[] arrs = {5,9,6,2,1,3,4,7,8,0};
        for (int i = 0; i < arrs.length-1; i++) {
            for (int j = 0; j < arrs.length-1-i; j++) {
                if (arrs[j]>arrs[j+1]){
                    int temp = arrs[j];
                    arrs[j]=arrs[j+1];
                    arrs[j+1]=temp;
                }
            }
        }
        printArr(arrs);
    }

    private static void printArr(int[] arrs) {
        for (int i = 0; i < arrs.length; i++) {
            System.out.print(arrs[i]+" ");
        }
        System.out.println();
    }
}
